package com.itheima.service.system.impl;



import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.dao.cargo.ExtCproductDao;
import com.itheima.dao.system.LeaveWordDao;
import com.itheima.domain.system.LeaveWord;
import com.itheima.domain.system.LeaveWordExample;
import com.itheima.service.system.LeaveWordService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
@Service
public class LeaveWordServiceImpl implements LeaveWordService {
    @Autowired
    private LeaveWordDao leaveWordDao;
    @Autowired
    private ExtCproductDao extCproductDao;


    @Override
    public LeaveWord findById(String id) {
        return leaveWordDao.selectByPrimaryKey(id);
    }

    @Override
    public void save(LeaveWord leaveWord) {
        leaveWordDao.insertSelective(leaveWord);
    }

    @Override
    public void update(LeaveWord leaveWord) {
        leaveWordDao.updateByPrimaryKeySelective(leaveWord);
    }

    //条件是合同id
    @Override
    public void delete(String id) {
        leaveWordDao.deleteByPrimaryKey(id);
    }

    @Override
    public List<LeaveWord> findAll(LeaveWordExample example) {
        return leaveWordDao.selectByExample(example);
    }

    @Override
    public PageInfo findByPage(int pageNum, int pageSize, LeaveWordExample example) {
        PageHelper.startPage(pageNum, pageSize);
        List<LeaveWord> list = leaveWordDao.selectByExample(example);
        return new PageInfo(list, 10);
    }

    @Override
    public List<LeaveWord> findLeaveWordVo(String inputDate, String companyId) {
        return leaveWordDao.findLeaveWordVo(inputDate, companyId);
    }

    @Override
    public Integer selectNum(String name) {
        return leaveWordDao.selectNum(name);
    }
}
